// 获取日期
export function getNowFormatDate(date) {
	let seperator1 = "-";
	let year = date.getFullYear();
	let month = date.getMonth() + 1;
	let strDate = date.getDate();
	if (month >= 1 && month <= 9) {
		month = "0" + month;
	}
	if (strDate >= 0 && strDate <= 9) {
		strDate = "0" + strDate;
	}
	let currentdate = year + seperator1 + month + seperator1 + strDate;
	return currentdate;
}

// 获取时间
export function getNowFormatDateTime(date) {
	let seperator1 = "-";
	let year = date.getFullYear();
	let month = date.getMonth() + 1;
	let strDate = date.getDate();
	let hours = date.getHours();
	let min = date.getMinutes();
	let sec = date.getSeconds();
	if (month >= 1 && month <= 9) {
		month = "0" + month;
	}
	if (strDate >= 0 && strDate <= 9) {
		strDate = "0" + strDate;
	}
	let currentdate =
		year +
		seperator1 +
		month +
		seperator1 +
		strDate +
		" " +
		hours +
		":" +
		min +
		":" +
		sec;
	return currentdate;
}

// 判断图片
export function isImage(ext) {
	if (!ext) {
		return false;
	}
	return (
		[
			"png",
			"jpg",
			"jpeg",
			"bmp",
			"gif",
			"webp",
			"psd",
			"svg",
			"tiff",
		].indexOf(ext.toLowerCase()) !== -1
	);
}
